import cv2
import numpy as np

img = cv2.imread("./basic01.png")
hsv_img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)

lowerb = np.array([35,43,46])
upperb = np.array([77,255,255])

mask = cv2.inRange(hsv_img, lowerb, upperb)

contours = cv2.findContours(mask, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)

x1, y1, w, h = cv2.boundingRect(contours[0][0])
x2, y2 = x1 + w, y1 + h

cv2.rectangle(img, (x1, y1), (x2, y2), color=(0, 0, 0), thickness=2)
cv2.putText(img,'green',(x1,y1),0,1,color=(0,255,0),thickness=2)

cv2.imshow("img", img)
cv2.waitKey(0)